import { defineConfig, loadEnv, type ConfigEnv } from "vite";
import { resolve } from "path";
import vue from "@vitejs/plugin-vue";
// @ts-ignore
import vueJsx from "@vitejs/plugin-vue-jsx";
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig((mode: ConfigEnv)=>{
  return {
    plugins: [
      vue(),
      vueJsx(),
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    ],
    resolve: {
      alias: {
        "@": resolve(__dirname, "src"),
      },
      extensions: [".ts", ".vue", ".js", ".jsx", ".tsx"], // 导入时想要省略的扩展名列表。
    },
    // server: {
    //   proxy: {
    //     "/app-dev": {
    //       target: "https://www.dance365.com/apis",
    //       changeOrigin: true,
    //       rewrite: (path) => path.replace(/^\/app-dev/, ""),
    //     },
    //   },
    // },
  }
})
